var fs = require('fs');
var path = require('path');

var subDir = process.argv[2];
var filter = process.argv[3];

fs.readdir('D:\\Node_XH',function(err,list){
    if(err){
        console.log(err);
    } else {
        console.log(list);
        for (var item of list){
            if(path.extname(item) ==='.'+ filter){
                console.log(item);
            }
        }
    }
});